package com.gzx.plugin.tjzy.modular.qianwen.controller;

import com.gzx.plugin.tjzy.modular.qianwen.service.IntentPromptService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;

/**
 * 跟进计划通知 gzx_trace_plan
 *
 * @author xbl
 * &#064;date  2025-03-28
 */
@Slf4j
@RestController
@RequestMapping("/tjzy/qianwen")
@RequiredArgsConstructor
public class GzxQianWenController {

    private final IntentPromptService promptService;

    /**
     * 分析通话意图
     */
    @PostMapping("/intent")
    public CommonResult<String> intent(@RequestParam String intent) {
        try {
            return CommonResult.data(promptService.analyzeIntent(intent));
        } catch (Exception e) {
            log.error("分析通话意图异常： {0} ", e);
            return CommonResult.error("分析通话意图 未知错误，请联系管理员");
        }
    }

}
